import e from "crypto-js"

const r = e.enc.Utf8.parse("KrQ4KAYOEyAz66RS");

const t = e.enc.Utf8.parse("ep1YCmxXuxKe4eH1");

export const encrypted = (n, c, a) =>{
    var p = r, s = t;
        c && (p = e.enc.Utf8.parse(c), s = e.enc.Utf8.parse(a));
        var d = e.enc.Utf8.parse(n), i = e.AES.encrypt(d, p, {
            iv: s,
            mode: e.mode.CBC,
            padding: e.pad.Pkcs7
        });
        return e.enc.Base64.stringify(i.ciphertext);
}

export const decrypted = (n, c, a) =>{
    var p = r, s = t;
        c && (p = e.enc.Utf8.parse(c), s = e.enc.Utf8.parse(a));
        var d = e.enc.Base64.parse(n), i = e.enc.Base64.stringify(d);
        return e.AES.decrypt(i, p, {
            iv: s,
            mode: e.mode.ECB,
            padding: e.pad.Pkcs7
        }).toString(e.enc.Utf8).toString();
}
